//
//  CustomFooter.m
//  MexicoLoan
//
//  Created by wxp on 2025/2/25.
//

#import "CustomFooter.h"

@implementation CustomFooter

#pragma mark - lazy
- (UILabel *)labelTitle{
    if (_labelTitle == nil) {
        _labelTitle = [UILabel new];
        [GlobalMethod setLabel:_labelTitle widthLimit:0 numLines:0 lineSpace:0 fontNum:15 textColor:COLOR_BLACK aligent:NSTextAlignmentCenter text:@""];
    }
    return _labelTitle;
}

- (void)prepare{
    [super prepare];
    [self addSubview:self.labelTitle];
}

- (void)placeSubviews{
    [super placeSubviews];
    self.labelTitle.width = SCREEN_WIDTH;
    self.labelTitle.centerXCenterY = XY(self.width/2.0, self.height/2.0);
}

#pragma mark - 监听scrollView
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{
    [super scrollViewContentOffsetDidChange:change];
}

- (void)scrollViewContentSizeDidChange:(NSDictionary *)change{
    [super scrollViewContentSizeDidChange:change];
}

- (void)scrollViewPanStateDidChange:(NSDictionary *)change{
    [super scrollViewPanStateDidChange:change];
}

#pragma mark 刷新状态
- (void)setState:(MJRefreshState)state{
    MJRefreshCheckState;
    switch (state) {
        case MJRefreshStateIdle:
            [self.labelTitle  fitTitle:@"Pull up to load more"  variable:0];
            break;
        case MJRefreshStatePulling:
            [self.labelTitle  fitTitle:@"Release refresh"  variable:0];
            break;
        case MJRefreshStateRefreshing:
            [self.labelTitle  fitTitle:@"Loading..."  variable:0];
            break;
        case MJRefreshStateNoMoreData:
            // [self.labelTitle  fitTitle:@"No more data"  variable:0];
            [self.labelTitle  fitTitle:@""  variable:0];
            break;
        default:
            break;
    }
}

@end
